import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-05-23
 * Time: 17:28
 */
@WebServlet("/password")
public class passwordServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println(req.getQueryString());
        //以字符串形式返回请求参数的值，或者如果参数不存在则返回null。
        String key=req.getParameter("key");
        String password=req.getParameter("password");
        resp.getWriter().write("key: "+key+"\n"+"password: "+password);
    }
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String key=req.getParameter("key");
        String password=req.getParameter("password");
        resp.getWriter().write("key: "+key+"\n"+"password: "+password);
    }
}
